package com.gzf.day35_encryptiondemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ArrowKeyMovementMethod;
import android.util.Base64;
import android.widget.TextView;

public class BaseActivity extends AppCompatActivity {

    private String str = "量窗量床又量墙，跳上床量窗，靠往墙量床，墙比张床长，床又比窗长，窗长不过床，床又长不过墙，所以墙比床比窗长。";
    private TextView mTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base);
        mTextView = (TextView) findViewById(R.id.textview);
        mTextView.setFocusableInTouchMode(true);
        mTextView.setFocusable(true);
        mTextView.setClickable(true);
        mTextView.setLongClickable(true);
        mTextView.setMovementMethod( ArrowKeyMovementMethod.getInstance());
        byte[] encode = Base64.encode(str.getBytes(), Base64.DEFAULT);
        byte[] decode = Base64.decode(encode, Base64.DEFAULT);
        mTextView.setText(new String(encode)+"\n"+new String(decode));
    }
}
